<?php
namespace Contact;

use Zend_Form;

class Form extends Zend_Form
{

    public function init()
    {
        $this->addElement('text', 'firstName', array(
            'required'  => true,
            'label'     => 'First Name',
            'maxLength' => '50'
        ));
        $this->addElement('text', 'lastName', array(
            'required' => true,
            'label'    => 'Last Name',
            'maxLength' => '50'
        ));
        $this->addElement('text', 'email', array(
            'required'   => true,
            'label'      => 'Email',
            'validators' => array('EmailAddress'),
            'maxLength' => '50'
        ));
        $this->addElement('text', 'phone', array(
            'label'      => 'Phone',
            'validators' => array(
                array('regex', false, array(
                    'pattern'  => '([0-9]{3}\.[0-9]{3}\.[0-9]{4})',
                    'messages' => 'Must be in XXX.XXX.XXXX format'
                ))
            ),
            'maxLength' => '12'
        ));
        $this->addElement('multiCheckbox', 'service', array(
            'label'        => 'Service',
            'required' => true
        ));
        $this->addElement('textarea', 'comments', array(
            'required' => true,
            'label'    => 'Comments',
            'attribs'  => array(
                    'cols' => '25',
                    'rows' => '4'
            )
        ));
        $this->addElements(array(
            array('reset', 'clearForm', array('label' => 'Clear')),
            array('submit', 'sendForm', array('label' => 'Send'))
        ));
        $this->setMethod('POST');
    }
}